Skip to content

Fix getStyle, getName, getIn return type to be consistent with construct.#4033

Merged
soyuka merged 2 commits into
api-platform:2.6from
cacahouwete:fix-openapi-parameter-style
Feb 10, 2021
Merged

Fix getStyle, getName, getIn return type to be consistent with construct.#4033
soyuka merged 2 commits into
api-platform:2.6from
cacahouwete:fix-openapi-parameter-style

Conversation

@cacahouwete

@cacahouwete cacahouwete commented Feb 8, 2021

Copy link
Copy Markdown
Contributor
Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
License MIT

When I put some custom documentation in my project with openapi_context I have the following error:

The method "ApiPlatform\Core\OpenApi\Model\Parameter::getStyle()" returned "null", but expected type "string". Did you forget to initialize a property or to make the return type nullable using "?string"?

When I check this class, I can see that there are some errors in return type definition. (Maybe adding attribute type definition could help phpstan to detect this kind of problems ?)

Fix getStyle, getName, getIn return type to be consistent with construct.

@soyuka soyuka added this to the 2.6.3 milestone Feb 10, 2021
@soyuka soyuka merged commit f12a426 into api-platform:2.6 Feb 10, 2021
@soyuka

soyuka commented Feb 10, 2021

Copy link
Copy Markdown
Member

good catch, I merged a bit to quickly may you add a test?

@dunglas

dunglas commented Feb 10, 2021

Copy link
Copy Markdown
Member

Isn't this a BC break?!

@soyuka

soyuka commented Feb 10, 2021

Copy link
Copy Markdown
Member

not really it should've been like this according to the constructor arguments

soyuka added a commit that referenced this pull request Feb 10, 2021
soyuka added a commit that referenced this pull request Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants